package com.iot.user.service.impl;

import com.alibaba.fastjson2.JSONObject;
import com.iot.user.mapper.UserMapper;
import com.iot.user.entity.User;
import com.iot.user.service.UserService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 用户service
 */
@Repository
@Slf4j
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;

    /**
     * 获取全部用户
     *
     * @return
     */
    @Override
    public List<User> getUsers() {
        log.info("getUsers的参数：" + "没有参数");
        List<User> users = userMapper.selectList(null);
        log.info("getUsers的返回：" + JSONObject.toJSONString(users));
        return users;
    }

    @Override
    public User testMapper(Long id) {
        return userMapper.testMapper(1L);
    }


}
